package cn.zuo.service.impl;

import cn.zuo.dao.UserMapper;
import cn.zuo.pojo.User;
import cn.zuo.service.UserService;
import cn.zuo.utils.MySqlSession;
import org.apache.ibatis.session.SqlSession;

import java.util.List;
import java.util.Map;
/**
 * @Author 白白旧维
 * @Date 2021/7/7 11:13
 */
public class UserServiceImpl implements UserService {

    private SqlSession sqlSession = MySqlSession.openSqlSession();
    private UserMapper userMapper = sqlSession.getMapper(UserMapper.class);

    @Override
    public User login(Map<String,Object> map){
        return userMapper.login(map);
    }

    @Override
    public int register(Map<String, Object> map) {

        int res = userMapper.register(map);
        sqlSession.commit();
        if(res<=0){
            sqlSession.rollback();
        }
        return res;
    }

    @Override
    public List<User> selectName(Map<String, Object> map) {
        return userMapper.selectName(map);
    }

    @Override
    public User verifyRegister(Map<String, Object> map) {
        return userMapper.verifyRegister(map);
    }

}
